#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<queue>
#include<algorithm>
#include<stack>
#include<cstring>
#include<vector>
#include<list>
#include<set>
#include<map>
using namespace std;
#define ll long long
#define pi (4*atan(1.0))
#define eps 1e-14
#define bug(x)  cout<<"bug"<<x<<endl;
const int N=1e5+10,M=1e6+10,inf=2147483647;
const ll INF=1e18+10,mod=2147493647;
int num[N][5];
int check0(int a,int x,int y,int z)
{
    if(a<0||x<0||y<0||z<0)return 0;
    int ans=0;
    if(x>=1&&y>=1&&z>=2)
    {
        int xx=x,yy=y,zz=z;
        xx-=1;yy-=1;zz-=2;
        int l=(xx/3+yy/3);
        zz-=min(zz/3,l)*3;
        if(zz<=a)ans=1;
    }
    if(x>=2&&y>=2&&z>=4)
    {
        int xx=x,yy=y,zz=z;
        xx-=2;yy-=2;zz-=4;
        int l=(xx/3+yy/3);
        zz-=min(zz/3,l)*3;
        if(zz<=a)ans=1;
    }
    int xx=x,yy=y,zz=z;
    int l=(xx/3+yy/3);
    zz-=min(zz/3,l)*3;
    if(zz<=a)ans=1;
    return ans;
}
int check1(int a,int x,int y,int z)
{
    return max(check0(a,x-1,y,z-1),check0(a,x,y-2,z-2));
}
int check2(int a,int x,int y,int z)
{
    return max(check0(a,x,y-1,z-1),check0(a,x-2,y,z-2));
}
char a[N];
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        memset(num,0,sizeof(num));
        int n,K;
        scanf("%d%d",&n,&K);
        scanf("%s",a+1);
        if(K==n-1)
        {
            int mmp=0;
            for(int i=1;i<=n;i++)
            if(a[i]%3==0)mmp=1;
            if(mmp)printf("yes\n");
            else printf("no\n");
            continue;
        }
        int sum=0;
        for(int i=1;i<=n;i++)
            sum+=a[i]-'0';
        int x=sum%3;
        for(int i=n;i>=1;i--)
        {
            int x=(a[i]-'0')%3;
            num[i][0]=num[i+1][0];
            num[i][1]=num[i+1][1];
            num[i][2]=num[i+1][2];
            num[i][x]++;
        }
        int ans=0;
        /// 枚举以i+1为起点的，去掉前i个，后面的需要去掉k-i个，进行check（）
        for(int i=0;i<=K;i++)
        {
            if(a[i+1]=='0')continue;
            if(x==1)ans=max(ans,check1(num[i+2][0],num[i+2][1],num[i+2][2],K-i));
            else if(x==2)ans=max(ans,check2(num[i+2][0],num[i+2][1],num[i+2][2],K-i));
            else ans=max(ans,check0(num[i+2][0],num[i+2][1],num[i+2][2],K-i));
            x-=a[i+1]-'0';
            x=(x%3+3)%3;
        }
        if(ans)
            printf("yes\n");
        else
            printf("no\n");
    }
    return 0;
}